package com.tongcheng.controller;

import com.tongcheng.ResultDate;
import com.tongcheng.feign.ActivityseviceFeign;
import com.tongcheng.feign.UserCouponsseviceFeign;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@CrossOrigin
public class UserCouponsController {
    @Autowired
    private UserCouponsseviceFeign userCouponsseviceFeign;

    @RequestMapping(value = "/userReceiveCoupons", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate userReceiveCoupons(@RequestParam(value ="userId") Integer userId, @RequestParam(value ="coupons_id") Integer coupons_id)  {
        return userCouponsseviceFeign.userReceiveCoupons(userId,coupons_id);
    }

    @RequestMapping(value = "/userSeeCoupons",method = RequestMethod.GET,produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)

    public ResultDate userSeeCoupons(Integer userId){
        return userCouponsseviceFeign.userSeeCoupons(userId);
    }

    @RequestMapping(value = "/merchantSeeCoupons",method = RequestMethod.GET,produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)

    public ResultDate merchantSeeCoupons(Long merchant_id){
        return userCouponsseviceFeign.merchantSeeCoupons(merchant_id);
    }
    @RequestMapping(value = "/merchantReceiveCoupons",method = RequestMethod.GET,produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)

    public ResultDate merchantReceiveCoupons(@RequestParam(value = "merchant_id")Long merchant_id,@RequestParam(value = "coupons_id") Integer coupons_id){
        return userCouponsseviceFeign.merchantReceiveCoupons(merchant_id,coupons_id);
    }
}
